package com.woniu.gateway.config;

import org.springframework.stereotype.Component;
import springfox.documentation.swagger.web.SwaggerResource;
import springfox.documentation.swagger.web.SwaggerResourcesProvider;

import java.util.Arrays;
import java.util.List;

@Component
public class SwaggerSourceConfig implements SwaggerResourcesProvider {

    /**
     * 下拉列表里面的资源列表配置  配的是数据地址
     */
    @Override
    public List<SwaggerResource> get() {
        return Arrays.asList(
                createResource("/order/v2/api-docs","订单服务"),
                createResource("/account/v2/api-docs","账号服务"),
                createResource("/gym/v2/api-docs","场馆服务"),
                createResource("/product/v2/api-docs","产品服务")
        );
    }

    private SwaggerResource createResource(String url,String name) {
        SwaggerResource sr = new SwaggerResource();
        sr.setLocation(url);
        sr.setName(name);
        sr.setSwaggerVersion("2.0");
        return sr;
    }

}
